package pro.lepers.portfolio.view.contents.portfolio {
	import fr.digitas.flowearth.ui.layout.Layout;
	import fr.digitas.flowearth.ui.layout.renderer.TopRenderer;
	import fr.digitas.flowearth.ui.text.StyledLabel;

	import pro.lepers.portfolio.view.contents.portfolio.data.ProjectDatas;

	import flash.display.Sprite;
	import flash.geom.Rectangle;

	/**
	 * @author plepers
	 */
	public class ProjectDescription extends Sprite {
		
		private static var WIDTH : int = 315;
		
		public function ProjectDescription () {
			_buildLayout();
			_build( );
		}

		internal function setDatas ( pdatas : ProjectDatas ) : void {
			
//			Lbl.text = pdatas.;
			titleLbl.text = pdatas.title;
			dateLbl.text = pdatas.date.toLocaleString();
			descLbl.text = pdatas.desc;
		}

		
		private function _build () : void {
			
			titleLbl = new StyledLabel();
			titleLbl.styleName = ".project_desc_title";
			titleLbl.tf.width = WIDTH;
			
			dateLbl = new StyledLabel();
			dateLbl.styleName = ".project_desc_date";
			dateLbl.tf.width = WIDTH;
			
			descLbl = new StyledLabel();
			descLbl.styleName = ".project_desc_desc";
			descLbl.tf.width = WIDTH;
			
			_layout.addChild( titleLbl );
			_layout.addChild( dateLbl );
			_layout.addChild( descLbl );
			
			_scrollRect = new Rectangle( 0, 0, WIDTH , 300 );
		}

		private function _buildLayout() : void {
			_layout = new Layout( );
			_layout.renderer = new TopRenderer( );
			_layout.y = -6;
			addChild( _layout );
		}
		
			
		public function get hiding () : Number {
			return _hiding;
		}
		
		public function set hiding (hiding : Number) : void {
			_hiding = hiding;
			if( _hiding == 0 ) scrollRect = null;
			else {
				_scrollRect.x = hiding * WIDTH;
				scrollRect = _scrollRect;
			}
		}

		private var _hiding : Number = 0;
		private var _scrollRect : Rectangle;
		
		
		
		private var _layout : Layout;

		private var titleLbl : StyledLabel;
		private var dateLbl : StyledLabel;
		private var descLbl : StyledLabel;
	
	}
}
